package com.mbc.mapper;


import com.mbc.pojo.MbcConcern;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 关注表 Mapper 接口
 * </p>
 *
 * @author suimeng
 * @since 2024-04-08
 */
@Mapper
public interface ConcernMapper {

    /**
     * 获取所有用户 ID
     *
     * @param userId 用户 ID
     * @return {@link List}<{@link MbcConcern}>
     */
    @Select("select * from mbc_concern where user_id = #{userId}")
    List<MbcConcern> getAllByuserId(String userId);

    /**
     * 删除关注 ID
     *
     * @param concernId 关注点 ID
     * @return int
     */
    @Delete("delete from mbc_concern where concern_id = #{concernId} ")
    int deleteConcernId(Integer concernId);

    /**
     * 新增关注
     *
     * @param userId    用户 ID
     * @param concernId 关注点 ID
     * @param now       现在
     * @return int
     */
    @Insert("insert into mbc_concern(user_id, concern_id, create_time) values (#{userId},#{concernId},#{now})")
    int insertConcern(Integer userId, Integer concernId, LocalDateTime now);
}
